<?php

namespace App\Controller\Common;

use App\Base\BaseConfig;
use App\Base\BaseController;
use App\Base\BaseModel;
use App\Base\BaseCache;
use BaseExt\JPush;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;


/**
 * @route("/logger")
 */
class LoggerController extends BaseController
{

    public function initData()
    {
        $request = Request::createFromGlobals();
        $url = $request->getBaseUrl();
        if (strpos($url,"pp_dev")>0) {
            $env = "dev";
            $data["rnd"] = "?rnd=".date("YmdHis");
//            $data["rnd"] = "?rnd=".date("YmdH");
            $data["asset"] = BaseConfig::__BASE_URL__;
            $data["root"] = BaseConfig::__BASE_URL__;
        } else {
            $env = "prod";
            $data["rnd"] = "?v=1.07";
            $data["asset"] = "http://sale.assets.sano100.com/ac/dc";
            $data["root"] = BaseConfig::__BASE_URL__;
        }
        $data["env"] = $env;
        $data["defaultPic"] = $data["asset"]."/assets/default.png";
        return $data;
    }

    /**
     * @route("/page",name="LoggerPage")
     */
    public function LoggerPage(){
        $data = $this->initData();

        return $this->render("Common/Logger/index.html.twig",$data);
    }





    /**
     * @route("/put",name="LoggerPut")
     */
    public function LoggerPut(){
        $bc = new BaseCache();
//        $bc->setItem("")
    }


    /**
     * @route("/get",name="LoggerGet")
     */
    public function LoggerGet(){
        $data = $this->initData();

        return $this->render("Common/Logger/index.html.twig",$data);
    }

}
